package com.service.base.generator.gencore.dbconfig.rules;


import com.service.base.generator.gencore.dbconfig.converts.ITypeConvert;
import com.service.base.generator.gencore.dbconfig.po.IColumnType;
import com.service.base.generator.gencore.genconfig.GlobalConfig;

/**
 * @author wangyongkun
 * @create 2020/12/13
 */
public class MySqlJdbcTypeConvertExt implements ITypeConvert {

    @Override
    public IColumnType processTypeConvert(GlobalConfig globalConfig, String fieldType) {
        String t = fieldType.toLowerCase();
        if (t.contains("char") || t.contains("text")) {
            return DbColumnType.varchar_;
        } else if (t.contains("bigint")) {
            return DbColumnType.bigint_;
        }  else if (t.contains("int")) {
            return DbColumnType.int_;
        }  else if (t.contains("decimal")) {
            return DbColumnType.decimal_;
        } else if (t.contains("clob")) {
            return DbColumnType.CLOB;
        } else if (t.contains("varchar")) {
            return DbColumnType.varchar_;
        }else if (t.contains("double")) {
            return DbColumnType.double_;
        }else if (t.contains("datetime")) {
            return DbColumnType.datetime_;
        }
        // todo 需要补充
        return DbColumnType.varchar_;
    }
}
